﻿using System.Windows.Data;
using System.Globalization;
using System.Windows;
using TMI85303.Utils;

namespace TMI85303.UI.Cov
{
    public class EnumToVisibilityConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value is Start_En status)
            {
                bool isVisible = (status == Start_En.ENABLE);
                // 如果parameter为"Invert"，则反转逻辑
                if (parameter?.ToString() == "Invert")
                {
                    isVisible = !isVisible;
                }
                return isVisible ? Visibility.Visible : Visibility.Hidden;
            }
            return Visibility.Hidden;
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException("Converting from Visibility to Start_En is not implemented.");
        }
    }

}
